<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<ui:composition template="../template/layout.xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets">
	<ui:param name="pageHeaderTitle" value="Treatment history" />
	<ui:define name="content">	
		<br />
		<h2 style="text-align: center">#{viewTreatmentHistoryBean.client.firstName} #{viewTreatmentHistoryBean.client.lastName}</h2>
		<h3 style="text-align: center">treatment history</h3>
		<div id="inner_content_high">
		
		<p:dataTable styleClass="treatmentHistoryResultTable" id="treatmentHistoryResultTable" var="treatmentAct" value="#{viewTreatmentHistoryBean.actList}" paginator="true" rows="10"  paginatorAlwaysVisible="false" 
		                paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}" paginatorPosition="bottom" pageLinks="5" selectionMode="single" rowKey="#{treatmentAct.id}">
			<p:ajax event="rowSelect" listener="#{viewTreatmentHistoryBean.onRowSelect}" />
			<p:column headerText="Date of appeal" style="width: 14%">
				<h:outputText value="#{treatmentAct.appealDate}" converter="stringToCalendarConverterNoTime" />
			</p:column>
			<p:column headerText="Symptoms" style="width: 48%">
				<h:outputText value="#{treatmentAct.symptoms}" />
			</p:column>
			<p:column headerText="Diagnosis" style="width: 28%">
				<h:outputText value="#{treatmentAct.diagnosis}" />
			</p:column>
			<p:column headerText="Paid" style="width: 10%" rendered="#{request.isUserInRole('Receptionist')}">
				<h:outputText style="color: green" value="Yes" rendered="#{treatmentAct.paidStatus}" />
				<h:outputText style="color: red" value="No" rendered="#{not treatmentAct.paidStatus}" />				
			</p:column>
		</p:dataTable>
		
		<br />
		<h:outputLink value="createTreatmentAct.xhtml?clientId=#{viewTreatmentHistoryBean.client.id}" rendered="#{request.isUserInRole('Receptionist')}">Create treatment act</h:outputLink>		
		</div>	
		<br />
		<div id="menu_info">
			<p:messages />
		</div>	
	</ui:define>
<ui:define name="footer">	
	<ui:param name="navBean" value="#{viewTreatmentHistoryBean}" />
	<ui:param name="navAction" value="goBack" />
	<ui:param name="navTitle" value="Back" />
	<ui:include src="/template/footer_bean_navigation.xhtml" />
</ui:define>
</ui:composition>
</html>